<!DOCTYPE html>
<html xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"
      xmlns:th="http://www.thymeleaf.org">
<head th:include="/include/commonHeader::commonHeader('数据字典(新增)')"></head>
<body>
<body class="gray-bg layer-blue">
<div class="wrapper wrapper-content  animated fadeInRight full-container">
    <div class="row">
        <div class="ibox float-e-margins">
            <div class="ibox-content">
                <div class="btn-group table-tool" id="exampleToolbar" role="group">
                    <input id="id" type="text" class="table-tool-btn pull-left"
                           placeholder="航班号" maxlength="4"/>
                    <!--  <select   id="query_airport" type="text" class="table-tool-btn pull-left"
                           placeholder="航班号" maxlength="4"/> -->
                    <button type="button" class="btn btn-outline btn-success btn-refresh" data-toggle="tooltip"
                            title="查询" id="btn-search">
                        <i class="fa fa-search" aria-hidden="true"></i>
                    </button>
                    <shiro:hasPermission1 name="basicinfo:overnightAirport:add">
                        <button type="button" onclick="add()" class="btn btn-outline btn-success"
                                data-toggle="tooltip" title="添加">
                            <i class="fa fa-plus" aria-hidden="true"></i>
                        </button>
                    </shiro:hasPermission1>
                    <button type="button" onclick="reload()" class="btn btn-outline btn-success "
                            data-toggle="tooltip" title="刷新">
                        <i class="fa fa-refresh" aria-hidden="true"></i>
                    </button>
                </div>
                <table id="exampleTable" data-classes="table table-hover table-condensed">
                </table>
            </div>
        </div>
    </div>
</div>
<script src="/plugins/bootstrapValidator/js/bootstrapValidator.min.js"></script>
<script src="/plugins/bootstrapValidator/js/language/zh_CN.js"></script>
<!-- 自定义js -->
<script th:inline="javascript">
    var prefix = "/dataDectionary";
    var moduleFlag = [[${moduleFlag}]];

    $(function () {
        load();
        $("#btn-search").click(function(){
            $("#exampleTable").bootstrapTable('refresh');
        });
    });
    function load() {
    	//alert(123)
        $('#exampleTable').bootstrapTable(
            {
                method: 'post',
                url: prefix+ "/list.do",
                striped: true,
                dataType: "json",
                pagination: true,
                clickToSelect: true,
                pageSize: 10,
                pageNumber: 1,
                showColumns: false,
                sidePagination: "server",
                paginationLoop: false,
                contentType: "application/x-www-form-urlencoded",
                queryParams: function (params) {
                    return {
                        limit: params.limit,
                        offset: params.offset,
                        nightAirport: $("#query_airport").val().toUpperCase()
                    };
                },
                onDblClickRow: function (row, $element, field) {
                    /*view(row.nightAirport);*/
                },
                columns: [
                    {
                        field: 'idx',
                        title: '序号',
                        formatter: orderFormatter,
                        valign: 'middle',
                        align: 'center',
                        width: '40'
                    },
                    {
                        field: 'cCode',
                        title: '编码'
                    },
                    {
                        field: 'cName',
                        title: '编码中文名称',
                        formatter: YNFormatter
                    },
                    {
                        field: 'cEname',
                        title: '编码英文名称',
                        formatter: YNFormatter
                    },
                    {
                        field: 'readonlyFlag',
                        title: '是否只读',
                        formatter: YNFormatter
                    },
                    {
                        field: 'moduleFlags',
                        title: '是否有效'
                    },
                    {
                        field: 'validFlag',
                        title: '备注'
                    },
                    {
                        title: '操作',
                        align: 'center',
                        visible: isShowOperation(),
                        formatter: function (value, row, index) {
                            return [
                                '<a class="' + p_edit + '" href="#" title="点击切换是否为过夜机场" onclick=toggle("' + row.nightAirport + '")>',
                                '<i class="glyphicon glyphicon-retweet"></i>',
                                '</a>&nbsp;&nbsp;',
                                '<a class="' + p_delete + '" href="#" title="删除（只能在所有部门都没有使用该过夜机场才可以删除）" onclick=remove("' + row.nightAirport + '")>',
                                '<i class="glyphicon glyphicon-remove text-danger"></i>',
                                '</a>&nbsp;&nbsp;'
                            ].join('');
                        }
                    }]
            })
    }
 

</script>
</body>
</html>